{% extends 'feedback/base.html' %} {% block title %} Список нарядов в работе {%endblock %} {% block content %}

<meta http-equiv="refresh" content="60" />
  {% include "naryad/menu.html" with address=request.resolver_match.view_name naryad_wait_count=naryad_wait_count naryad_in_work_count=naryad_in_work_count %}
    <div class="container-fluid">
        <table class="table table-sm">
            <thead>
                <tr>
                    <th scope="col" style="width:10%" class="text-center">№ Наряда</th>
                    <th scope="col" style="width:10%" class="text-center">Ответственный</th>
                    {% comment %} <th scope="col" style="width:10%" class="text-center">Специалист</th> {% endcomment %}
                    <th scope="col" style="width:17%" class="text-center">Передать</th>
                    <th scope="col" style="width:12%" class="text-center">Пациент</th>
                    {% comment %} <th scope="col" style="width:8%" class="text-center">Фото</th> {% endcomment %}
                    <th scope="col" style="width:18%" class="text-center">Комментарий</th>
                    <th scope="col" style="width:7%" class="text-center">Услуги</th>
                    <th scope="col" style="width:7%" class="text-center">Дней на этапе</th>
                    {% comment %} <th scope="col" style="width:6%" class="text-center">№ Этапа</th> {% endcomment %}
                </tr>
            </thead>
        </table>
    </div>
    <div class="container-fluid">
  {% for naryad in naryad_list %}

      {% if naryad.images.all %}
      <details>
          <summary>
      <table class="table table-success table-striped table-sm table-hover ">
      {% else %}
      <table class="table table-sm table-hover ">
      {% endif %}
      <tbody>
          <tr>
              <td style="width:10%" class="text-center"><a  href="{% url 'naryad_upd' naryad.id %}" class="btn btn-block"> <b>{{ naryad.nkv }}</b></a></td>
              <td style="width:10%" class="text-center">{{ naryad.sdl_etap.name_sdl }}<br>{{ naryad.current_spec_fio }}</td>
              {% comment %} <td style="width:10%" class="text-center">{{ naryad.current_spec_fio }}</td> {% endcomment %}
              {% if naryad.sdl_etap.sdl == 1 and naryad.id_etap != 1 %}

                  <td style="width:17%" class="text-center"><a href="{% url 'next_etap' naryad.id 35 False 0%}">
                      <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать Технику">
                          <input class="" type="image" src="/static/img/tech.png" alt="Передать технику" width="30" height="30" class="me-2">
                          </span></a>
                  </td>
              {% elif naryad.sdl_etap.sdl == 35 and naryad.id_etap != 1%}
                  <td style="width:17%" class="text-center">
                      <div class="d-flex justify-content-evenly">

                  <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать врачу">
                      <a href="next_etap/{{ naryad.id }}/1/False/0"><input class="" type="image" src="/static/img/doctor.png" alt="Передать врачу" width="30" height="30" class="me-2"></a>
                  </span>

              {% if naryad.sdl_set.lit > 0 %}

                  <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать литейщику">
                  <a href="{% url 'next_etap' naryad.id 37 False 0%}"><input class="" type="image" src="/static/img/ltk.png" alt="Передать литейщику" width="30" height="30" class="me-2"></a>
                  </span>

              {% endif %}
              {% if naryad.sdl_set.pol > 0 %}

                  <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать полировщику">
                  <a href="{% url 'next_etap' naryad.id 36 False 0%}"><input class="" type="image" src="/static/img/plk.png" alt="Передать полировщику" width="30" height="30" class="me-2"></a>
                  </span>

              {% endif %}
              {% if naryad.sdl_set.cad > 0 %}

                  <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать CadCam">
                  <a href="{% url 'next_etap' naryad.id 38 False 0%}"><input class="" type="image" src="/static/img/cadcam.png" alt="Передать CadCam" width="30" height="30" class="me-2"></a></td>
                  </span>

              {% endif %}
          </div>
              {% elif naryad.sdl_etap.sdl == 36 and naryad.id_etap != 1 %}
              <td style="width:17%" class="text-center"><a href="{% url 'next_etap' naryad.id 35 False 0%}">
                  <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать Технику">
                      <input class="" type="image" src="/static/img/tech.png" alt="Передать технику" width="30" height="30" class="me-2">
                      </span></a>
              </td>
              {% elif naryad.sdl_etap.sdl == 37 and naryad.id_etap != 1 %}
              <td style="width:17%" class="text-center"><a href="{% url 'next_etap' naryad.id 35 False 0%}">
                  <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать Технику">
                      <input class="" type="image" src="/static/img/tech.png" alt="Передать технику" width="30" height="30" class="me-2">
                      </span></a>
              </td>
              {% elif naryad.sdl_etap.sdl == 38 and naryad.id_etap != 1 %}
              <td style="width:17%" class="text-center"><a href="{% url 'next_etap' naryad.id 35 False 0%}">
                  <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Передать Технику">
                      <input class="" type="image" src="/static/img/tech.png" alt="Передать технику" width="30" height="30" class="me-2">
                      </span></a>
              </td>
              {% else %}
                  <td style="width:17%" class="text-center">
                    <a href="{% url 'naryad_upd' naryad.id %}">
                        <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Распределить наряд">
                            <input class="" type="image" src="/static/img/associated.png" alt="Передать технику" width="30" height="30" class="me-2">
                        </span>
                    </a>
              {% endif %} 
              <td style="width:12%" class="text-center">{{ naryad.patient.fam }} {{ naryad.patient.im|slice:"1" }}. {% if naryad.patient.ot != " "%} {{ naryad.patient.ot|slice:"1" }}.{% endif %}</td>
              {% comment %} <td style="width:8%" class="text-center">
                  {% if naryad.images.all %}
                  {{ naryad.images.all|length }}
                  {% else %}
                  Нет
                  {% endif %}
              </td> {% endcomment %}
              <td style="width:18%" class="text-center">
                  {% if naryad.kom_etap|length > 0 %}
                  {{ naryad.kom_etap }}
                  {% else %}
                  Нет
                  {% endif %}
              </td>
              <td style="width:7%" class="text-center">
                  <div
                      hx-get="{% url 'uslugi_modal' naryad.id %}"
                      hx-swap="innerHTML"
                      hx-target="#place_for_modal"
                      hx-select="#modal_uslui"
                      hx-trigger="click"
                      class="btn btn-block"
                      > <b>Услуги</b>
                  </div>
              </td>
              {% comment %} <td style="width:6%" class="text-center">{{ naryad.id_etap }}</td> {% endcomment %}
              <td style="width:7%" class="text-center">{{ naryad.get_days }}</td>
          </tr>
      </tbody>
  </table>
  </summary>
  <div class="col">
      {% for image in naryad.images.all %}

              <img
              hx-get="/naryad/image_fullscreen/{{image.id}}"
              hx-target="#place_for_modal"
              hx-select="#imageview_modal"
              hx-swap="innerHTML"
              hx-trigger="click"
              src="{{ image.img.url }}"
              style="width:100px;height:100px;"
              alt="">
      {% endfor %}
  </div>
  </details>


  {% endfor %}
  </div>
  <div id="place_for_modal">
  </div>

  <script>
      var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
  var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
    return new bootstrap.Popover(popoverTriggerEl)
  })



</script>

<div id="place_for_modal"></div>

{% endblock %}
